﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using SharpDND.Core;
using SharpDND.Core.Entity.NonMonster;

namespace SharpDNDTools.UserControls.Core
{
    public partial class ucViewRaces : UserControl
    {
        public ucViewRaces()
        {
            InitializeComponent();
            LoadGrid();
        }

        private void LoadGrid()
        {
            Race Race = new Race();
            List<Race> listOfRace = new List<Race>();

            foreach (SharpDNDBase baseObj in Race.GetAll())
            {
                if (baseObj is Race)
                {
                    listOfRace.Add((Race) baseObj);
                }
            }

            this.Update();
        }

        private void mainViewer_OnItemSorted(object sender, EventArgs e)
        {
            foreach (Race Race in ((List<Race>) ((BindingSource) sender).DataSource))
            {
                Race.Save();
            }
        }

        private void mainViewer_OnGridDoubleClicked(object sender, EventArgs e)
        {
            Race Race = new Race();
        }

        private void mainViewer_OnAddButtonClicked(object sender, EventArgs e)
        {
        }
    }
}